import asyncio
import aiohttp
import json

async def f1(session):
    url = 'https://www.cwl.gov.cn/cwl_admin/front/cwlkj/search/kjxx/findDrawNotice?name=ssq&pageNo=1&pageSize=30&systemType=PC'

    head = {
        "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36",
    }
    async with session.get(url,headers=head) as res:
        return await res.text()

async def f2(res):
    red_count = {}

    data = json.loads(res)
    for item in data["result"]:
        red_list = item["red"].split(',')
        print(red_list)
        for i in red_list:
            if i in red_count:
                red_count[i] += 1
            else:
                red_count[i] = 1
    print(red_count)

async def main():
    async with aiohttp.ClientSession() as session:
        res=await f1(session)
        await f2(res)




loop =asyncio.get_event_loop()
loop.run_until_complete(main())